package com.lala.rennigou.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lala.rennigou.mapper.EasybuyProductCategoryMapper;
import com.lala.rennigou.pojo.EasybuyProduct;
import com.lala.rennigou.pojo.EasybuyProductCategory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
@Service
public class EasybuyProductCategoryServiceImpl  implements EasybuyProductCategoryService {
    @Autowired
    private EasybuyProductCategoryMapper easybuyProductCategoryMapper;
    @Override
    public List<EasybuyProductCategory> selectByMap(int type) {
        return easybuyProductCategoryMapper.selectByMap(type);
    }

    @Override
    public List<EasybuyProduct> selectproduct() {
        return easybuyProductCategoryMapper.selectproduct();
    }

    @Override
    public int produckByName(String name) {
        return easybuyProductCategoryMapper.produckByName(name);
    }

    @Override
    public PageInfo<EasybuyProductCategory> selectall(int pagenum,int pagesize) {
        PageHelper.startPage(pagenum,pagesize);
        PageInfo<EasybuyProductCategory> pageInfo = new PageInfo<>(easybuyProductCategoryMapper.selectall());
        return pageInfo;
    }

    @Override
    public EasybuyProductCategory categoryById(int id) {
        return easybuyProductCategoryMapper.categoryById(id);
    }

    @Override
    public List<EasybuyProductCategory> allCatagory() {
        return easybuyProductCategoryMapper.selectall();
    }

    @Override
    public int deleteC(int id) {
        return easybuyProductCategoryMapper.deleteById(id);
    }

    @Override
    public int categoryByName(String name) {
        return easybuyProductCategoryMapper.categoryByName(name);
    }

    @Override
    public int insertC(EasybuyProductCategory easybuyProductCategory) {
        return easybuyProductCategoryMapper.insert(easybuyProductCategory);
    }

    @Override
    public int updateC(EasybuyProductCategory easybuyProductCategory) {
        return easybuyProductCategoryMapper.updateById(easybuyProductCategory);
    }


}
